<?php

include_once('../../php/postgre.php');
$idb = $_GET['idb'];
if (is_numeric($idb)) {  
    $bid = get_data("Select * from mus_bidang_bappeda where id_bdgbapeda = '$idb'");
    $row1 = get_data("SELECT COUNT(*) as count from mus_subbidangbappeda where id_bdgbapeda = '$idb'");
    $kdbd = $bid['id_bdgbapeda'];
    $vlue = $row1['count'] + 1;
    $kodesub = ($vlue <= 9) ? "0" . $vlue : $vlue;
    $kd = $kdbd . "." . $kodesub;
    echo $kd;
}
?>